package vn.nt.healthcare.server.ws.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import vn.nt.healthcare.server.ws.model.Customer;
import vn.nt.healthcare.server.ws.service.CustomerService;

@Controller
public class CustomerController {

	@Autowired
	private CustomerService customerService;

	@RequestMapping(value = "/listcustomers", method = RequestMethod.GET)
	@ResponseBody
	public List<Customer> findAllCustomers(HttpServletRequest request,
			@RequestParam(value = "companyId", required = true) String companyId) {
		return customerService.findAllCustomer(companyId);
	}

	@RequestMapping(value = "/detailcustomer", method = RequestMethod.GET)
	@ResponseBody
	public Customer findCustomerById(
			HttpServletRequest request,
			@RequestParam(value = "companyId", required = true) String companyId,
			@RequestParam(value = "id") int id) {
		return customerService.findCustomerById(companyId, id);
	}

}
